package com.atguigu.base.v1;

import java.util.concurrent.TimeUnit;

public class Ticket {
    private int number = 50;
    public synchronized  void sale(){
        if(number > 0){

            System.out.println(Thread.currentThread().getName()+"\t"+"卖了第"+ (number--));
            try {
                TimeUnit.SECONDS.sleep(1);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
        }
    }
}
